<?php

namespace App\Edu\Controllers;

use App\Edu\Facades\EduCourseFacade;
use App\Edu\Facades\EduPaperFacade;
use App\Http\Controllers\BaseController;
use App\Services\AuthUser;
use Illuminate\Http\Request;

class ApiController extends BaseController
{
    use AuthUser;

    /** 
     * 获取试卷信息
     */
    public function paperInfo(Request $request)
    {
        $this->validate($request, [
            'paper_id' => 'required',
        ]);
        return EduPaperFacade::paperInfo($request->input('paper_id'), $this->getAuthUserId());
    }

    /** 
     * 获取试卷列表
     */
    public function paperList(Request $request)
    {
        $this->validate($request, [
            'page' => 'integer',
            'page_size' => 'integer',
        ]);
        $params = $request->only(['page', 'page_size']);
        $params['user_id'] = $this->getAuthUserId();
        return EduPaperFacade::paperList($params);
    }
}
